use proto_bytes::ProtoEncode2;
use super::driver::{motor, sensor};

const VERSION: u16 = 0x0B;


pub fn collect() -> impl ProtoEncode2 {

    let sen = (sensor::is_drop_sw1() as u16) |
    ((sensor::is_drop_sw2() as u16) << 1) |
    ((sensor::is_drop_sw3() as u16) << 2) |
    ((sensor::is_film_sw() as u16) << 3) |
    ((sensor::is_film_checked() as u16) << 4) |
    ((sensor::is_cut_top() as u16) << 5) |
    ((sensor::is_cut_bottom() as u16) << 6) |
    ((sensor::is_cut_checked() as u16) << 7) |
    ((sensor::is_drop_checked1() as u16) << 8) |
    ((sensor::is_drop_checked2() as u16) << 9) |
    ((sensor::is_drop_checked3() as u16) << 10) |
    ((sensor::is_leak() as u16) << 11) |
    ((sensor::is_waste_checked() as u16) << 12) |
    ((sensor::is_cup_checked() as u16) << 13);

    let analog = motor::analog_value();

   // log::info!("top:{} bottom:{}", sensor::is_cut_top(), sensor::is_cut_bottom());

    (VERSION, (sen, analog))
}





